<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function formatNumber(num) {
            var nums = num.toString().split(".");
            nums[0] = nums[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");//正则匹配
            return nums.join(".");
        };
        var a = formatNumber(1855184135132);
        console.log(a)
    </script>
</body>
</html>